home *** CD-ROM | disk | FTP | other *** search
/ Amiga Plus 2002 #3 / Amiga Plus CD - 2002 - No. 03.iso / AmiSoft / Comm / Tcp / Getallhtml.lha / GetAllHTML.doc < prev    next >
Encoding:
Text File  |  2003-02-10  |  15.2 KB  |  336 lines

  1. GetAllHTML v1.01  Copyright 1998-2002 Christoper S Handley
  2. ==========================================================
  3. Latest News
  4. -----------
  5. This is a minor update to my "final" v1.00 release.  I have added an AmigaDOS
  6. script that makes using GetAllHTML easier, and also added directions on how to
  7. run GetAllHTML from a button in IBrowse.
  8.  
  9.  
  10. If you cannot get ARexx to work, please read my warning below about text
  11. editors.
  12.  
  13. Introduction
  14. ------------
  15. Have you ever visited a cool web site & wanted to keep a copy of some/all of it,
  16. but it would takes ages to find & download all the respective pages/files?
  17.  
  18. This is the answer!
  19.  
  20. You supply this ARexx script with the start page URL, and a destination
  21. directory (which should be empty), and maybe a few other options - and off it
  22. goes!  Note that it needs HTTPResume v1.3+ to work (get from Aminet).
  23.  
  24. The idea for this came from a PC Java program called PageSucker - sadly it is
  25. over 1Mb in size & buggy (& can't be run on the Amiga, yet).  Although my
  26. implementation may not have quite as many features, it is does do the job quite
  27. fast, & has relatively low memory overheads.
  28.  
  29. Requirements
  30. ------------
  31.  o HTTPResume v1.3+ (but v1.7 is recommended)
  32.  
  33.  o An Amiga capable of running ARexx programs
  34.  
  35.  o Libs:Rexxsupport.library
  36.  
  37.  o Modem with TCP/IP stack (like Genesis, Miami, or AmiTCP)
  38.  
  39. Usage
  40. -----
  41. 1.Before running it for the first time you must (text) edit (say using C:ED) it
  42. to know where your copy of HTTPResume is located.  Go to line 19 where it says:
  43.     HTTPResume='Programs:Utils/Comms/HTTPResume'
  44. Alter the file path between the 'quotes' to where you keep HTTPResume, and save.
  45.  
  46. 2.Run your TCP/IP stack (e.g.AmiTCP/Genesis or Miami).
  47.  
  48. 3.Run it from a Shell using:
  49.  
  50.     Sys:RexxC/Rx GetAllHTML arguments
  51.  
  52. Where the arguments are:
  53.  
  54. "URL"/A, "DestDir"/A, NOASK/S, ARC/S, PIC/S, RESUME/S, PAUSE/S, DEPTH=/N/K,
  55. NOBASEINDEX, PORT=/K, BASEURL=/K, BROKELINKS/S
  56.  
  57. Note - The destination dir must be empty of any previous attempt at downloading
  58. that web page (unless using the RESUME switch).  And that both URL & DestDir
  59. *must* be enclosed in "double quotes" - and that the BASEURL must NOT be
  60. surrounded by quotes!
  61.  
  62. *Note* you may have several GetAllHTMLs & HTTPResumes running at the same time
  63. (not on the same URL!), and that if you use the PORT argument then you will need
  64. HTTPResume running first.
  65.  
  66. See the file GetAllHTML_ex.script for an example usage - it will download all of
  67. Squid's on-line artwork (hope he gets a few more sales of his wonderful 'other
  68. world' artwork from this :-).
  69.  
  70. But It's Too Complicated!
  71. -------------------------
  72. Well, you can use my "GetAllHTML_simple" script.  First, put GetAllHTML.rexx in
  73. the Rexx: directory (typically Sys:Rexx/ or Sys:S/).  Next, put
  74. GetAllHTML_script somewhere in your command path, e.g. in your C: directory.
  75.  
  76. Now open a shell and type:
  77. GetAllHTML_simple http://some.web.page
  78.  
  79. A requester should pop-up, asking where you want to save the web page(s) to; I
  80. recommend making a new subdirectory on your harddisk.  Click OK to start
  81. downloading http://some.web.page :-)
  82.  
  83. Behaviour
  84. ---------
  85. It's default behaviour is to find all links in each HTML page, and download them
  86. if:
  87.  
  88. -the URL path is a sub-directory of the original URL path; this stops
  89. downloading irrelevant pages on different topics, different servers, etc.., AND
  90.  
  91. -if they are HTML pages (name ends in .html, etc), OR
  92.  
  93. -if not HTML pages then it will ask if the file should be downloaded; if answer
  94. does not begin with an "n" then it does (download).  If the file has the same
  95. suffix as the last positively confirmed download, then 'intelligently' assumes
  96. should download...
  97.  
  98. This behaviour is modified by various switches:
  99.  
  100. RESUME    - Should downloading of pages have been interupted (maybe a crash), run
  101.     GetAllHTML with *exactly* the same options, except with this switch too.
  102.     It will take a while to reach the same place as all previous HTML pages
  103.     must be scanned - and some additional memory usage is incured.
  104.  
  105.      I suggest you don't go on-line until it has reached the previously
  106.     interupted point (it wait for you to press return).
  107.  
  108.     *NOTE* that this mode is flawed due to the way GetAllHTML.rexx works,
  109.     so that it will sometimes think it has reached the previously finished
  110.     point, when it has not in fact.  Still RESUME is very useful!  And an
  111.     AmigaE version would fix this.
  112.  
  113. PIC    - Will identify links to pictures & download them rather than ask.
  114.  
  115. ARC    - Will identify links to archives & download them rather than ask.
  116.  
  117. NOASK    - Do not ask user if should download a file, assume should not.
  118.  
  119. PAUSE   - DO ask user to "press <return>" if we get an empty URL or couldn't
  120.     download a file.  Always asked to by the RESUME function.
  121.  
  122. TERSE    - Only outputs very important text, so it won't report strange URLs,
  123.     failure to download files, non-http links, etc...
  124.  
  125. PORT    - Supplies the ARexx port of a *running* HTTPResume; if supplied then
  126.     does not try to launch HTTPResume from AmigaDOS.  See *Note* below.  If
  127.     no port name is supplied then it sees if the current ARexx port is
  128.     already set to some HTTPResume - if not then an error is generated, else
  129.     it just uses that port.
  130.  
  131. DEPTH    - This allows you to specify how many URL links to follow in sequence;
  132.     i.e.the depth of the search.  DEPTH=2 means download only the links from
  133.     the original page, and so on for DEPTH=3, etc..  See *Note* below.  If
  134.     no number is supplied then the user is asked for a number.
  135.  
  136. NOBASEINDEX - This prevents GetAllHTML from following links to the index of the
  137.     original URL path.  Is useful for web sites which are fairly 'flat'
  138.     (ie.do not have many sub-directories), which also have banners at the
  139.     top of pages to take you straight to the site's main page (which will
  140.     has links you are not interested in).  Probably very rarely needed.
  141.  
  142. BASEURL - This allows you to override the semi-intelligent default, and tell
  143.     GetAllHTML the base URL - that is, what the URL must start with for it
  144.     to even consider downloading it.  This is useful if you wish to download
  145.     from a particular page deep down the directory structure, but which
  146.     references images (or maybe pages) that are further up.
  147.  
  148. BROKENLINKS - This causes attempted downloading of pages that are not
  149.     sub-directories of the original URL.  These will be downloaded to "T:"
  150.     (which is usually "RAM:T") & then deleted.  If download failed then you
  151.     will be told that there was a broken link.  See suggested uses below.
  152.  
  153. *Note* that both DEPTH & PORT must be followed by an equals sign ("=") and then
  154. the data, _without_ any spaces between anything.  This is due to a limitation of
  155. ARexx, for which an AmigaE version would fix.
  156.  
  157. SOLUTIONS TO FREQUENT PROBLEMS
  158. ------------------------------
  159. 1.If ARexx complains there is an error in the GetAllHTML code (when you try to
  160. run it), then it is VERY likely that the problem comes from editing GetAllHTML
  161. in a text editor.
  162.  
  163. Many text editors seem to be EXTREMELY badly coded, so that they can't handle
  164. the very long lines I have in GetAllHTML; they usually end up splitting a line
  165. in 2, or even deleting everything past a certain point on the line...
  166.  
  167. I strongly suggest buying CygnusEd (v3.5 or v4), as this is what I use, and I
  168. have never had any problems with it; it can even load in binary files, and save
  169. them back without loosing anything!
  170.  
  171. Suggested uses
  172. --------------
  173. 1.Add a custom button to IBrowse (from Preferences window GUI/Toolbar), set it's
  174. action to "Command", have it execute "Scripts:GetAllHTML_simple", and give the
  175. parameter "%u".  DO NOT USE THE "QUOTES"!
  176.  
  177. Now when you are on a web page you wish to save, simply click on the new button,
  178. a requester will pop-up asking where to save it, and then it will start saving,
  179. keeping you up-to-date with progress in the window at the bottom of the screen.
  180.  
  181. Please note that if you want the requester to appear on the IBrowse screen, you
  182. must make the public MUI screen IBrowse uses called "WebBrowser".
  183. Alternatively, change the command parameter to "%u PUBSCREEN=XXX", where XXX is
  184. the name of IBrowse's screen.
  185.  
  186.  
  187. 2.There's a big web site with lots of pictures/music/archives/information that
  188. interests you.  Depending on what you want, you will need to use the PIC, ARC,
  189. and NOASK switches.
  190.  
  191. For instance, if you are only interested in pictures then use PIC & NOASK.  If
  192. you are only interested in archives then use ARC & NOASK.  If you are interested
  193. in something else than pictures or archives (in addition to the web pages), then
  194. don't use any of those three switches - GetAllHTML will ask you if something
  195. should be downloaded.
  196.  
  197.  
  198. 3.You have your own home-page on the web, and it includes lots of links to other
  199. sites for which take hours to check they are all valid.  Point GetAllHTML at
  200. your web site with the BROKENLINKS switch.  Note it will never try to download a
  201. link twice, even withOUT using RESUME.
  202.  
  203. In fact, if you have your web site in a directory on your HD, then you could
  204. RESUME with that directory as your download directory; this will be MUCH faster
  205. since none of your pages will (or should) be downloaded :-)) .  First time you
  206. try this, do it on a back-up copy to ensure GetAllHTML does not do anything
  207. strange (I won't be held responsible for extra files 'magically' appearing!)..
  208.  
  209.  
  210. 4.I haven't tried this out myself, but it should be really cool:
  211.  
  212. If you have a favourite news page then you can use GetAllHTML to download just
  213. the latest news.  Suggest use NOASK, possibly with PIC if you want pictures too.
  214. You will obviously need to delete (or rename) the main news-page file, to force
  215. GetAllHTML to download the latest index which contains links to the new news.
  216.  
  217. I don't think you need to use RESUME, but...
  218.  
  219.  
  220. Any other ideas?
  221.  
  222. Bugs & other unwelcome features
  223. -------------------------------
  224.  o The RESUME feature *may* cause some files to be missed, but this depends on
  225. how ARexx treats funny characters for variable names.  An AmigaE version would
  226. fix any problems.
  227.  
  228.  o Interpretation of the HTML & URLs is based on observation rather than any
  229. specification of these standards - thus there will probably be rare cases in
  230. which it may misinterpret them; as long as these are reported (along with the
  231. responsible HTML file(s)), fixes will probably be forth coming.
  232.  
  233. But it really seems to work fine for the sites I have tried :-)
  234.  
  235.  o You cannot go above a depth of 42; this is to protect against an ARexx
  236. limitation which will cause problems above a depth of about 45.  An AmigaE
  237. version would fix this.
  238.  
  239. Technical info
  240. --------------
  241. GetAllHTML uses a depth-first tree search, via recursion, and uses the existance of
  242. (downloaded) files as a super-fast (for ARexx!) record of whether a page has
  243. been visited or not.
  244.  
  245. When RESUMEing, existance of files cannot be used to record if a page has been
  246. visited, so an alternate method is used - this is slower, and could fail with
  247. certain combinations of strangely named URLs (very unlikely); a far slower
  248. method would avoid this, but was considered unnecessary.
  249.  
  250. I used the INTERPRET command to do some magic with ARexx to make the arbitarily
  251. long linked-lists (really branches) possible - they were required for storing
  252. what pages have been visited.  Although this method is not very memory efficient
  253. (many duplicate entries of the same URL), it is quite fast - and more
  254. importantly it *works* in ARexx.  I had thought it would be virtually impossible
  255. to make arbitarily extended link-lists in ARexx, but the interpretive nature of
  256. ARexx means you can effectively create ARexx commands on-the-fly.
  257.  
  258. Future
  259. ------
  260. I have no plans for the future.  It has proven to work very well, and I have not
  261. updated it in 2 years.
  262.  
  263. About the Author
  264. ----------------
  265. My name is Christopher S Handley.  You're not really interested in me are you?!
  266.  
  267. Contacting the Author
  268. ---------------------
  269. Email: cshandleyATiee.org
  270. [You need to replace AT with @ to make this a valid email address.]
  271.  
  272. I am not yet sure about giving my snail mail address to all & sundry - sorry
  273. about that :-(I know how I felt when people did that before I had email access).
  274.  
  275. Thanks to
  276. ---------
  277.  o Andrija Antonijevic for HTTPResume
  278.  
  279.  o whoever design the Rexx language - Rexx is great for 'user utilities'.
  280.  
  281. History
  282. -------
  283. v1.01  (10-02-03) - Added a script to make it easier to use, and explanation
  284.                     of how to run GetAllHTML from an IBrowse button.
  285. v1.00  (22-08-02) - Should now handle URLs with "?" in them.  Now considers
  286.                     SWF (flash) files as pictures.  Final version?
  287.                     Added anti-spam stuff to email address :(
  288. v0.66ß (30-01-00) - Updated docs with new email address, warning about text
  289.             editors causing problems, and other small changes.
  290. v0.65ß (16-10-99) - Now searches from "HREF=" not "<A HREF=" which will give
  291.             dramatic improvement on some pages!  Rewrote how "./"s are
  292.             interpreted, which seems to be much better (perfect?).
  293.             Added the NOBASEINDEX switch.  Removed uses of Translate()
  294.             since it was doing nothing - so a small speed-up (esp.for
  295.             RESUME).
  296. v0.64ß (04-04-99) - Put back the 'extra' END that I removed in v0.61 .  Now
  297.             BROKENLINKS will always only try to download external links
  298.             once.  Removed NOENV argument of HTTPResume so proxy
  299.             settings may work.  Minor changes.
  300. v0.63ß (04-04-99) - Removed spurious non-visible ASCII (27) characters that
  301.            caused some text editors to go loopy.
  302. v0.62ß (03-04-99) - Add the BROKENLINKS switch.  Replaced NOPAUSE by PAUSE
  303.            switch.  Now always warns if a file could not be downloaded
  304.            (not just pages).  If you used all the arguments then it
  305.            would miss the last one.
  306. v0.61ß (28-03-99) - Possible fix for RESUME problem done, plus stupidly left an
  307.            extra END where it broke GetAllHTML.
  308. v0.60ß (27-03-99) - First stand-alone Aminet release.  Damn!  There were 3 big
  309.            mistakes...  (a)some files expected as directories,
  310.            (b)local-path expansion was too complex & probably wrong
  311.            (hope right now), (c)implicit InDeX.hTmL files were not
  312.            scanned for files.  Also asked user to press return but
  313.            really wanted a key first!
  314. v0.55ß (14-12-98) - Damn!  All this fast programming has introduced some bugs,
  315.            but they are fixed now; included the "~" interpretation was
  316.            completely wrong (removed), and fixed a long standing bug
  317.            where a URL beginning with a slash was mis-understood.  Also
  318.            added the BASEURL feature which is really useful sometimes.
  319. v0.54ß (12-12-98) - Given I couldn't download the KOSH pages (www.kosh.net), I
  320.            added basic frame support, and fixed a long standing bug
  321.                    where root html pages could appear as empty directories!
  322.            Two more long standing bugs fixed (ARC & PIC switches had
  323.            inverted sense).  Add fix for paths with "~" in, so will
  324.            align path correctly.  Add semi-intelligence so that won't
  325.            ask about downloading a file with the same suffix as the
  326.            last file that was confirmed.  Add the TERSE function.
  327. v0.53ß (10-12-98) - The DEPTH feature now works, added the PORT feature,
  328.            added the NOPAUSE feature.  Fixed long standing bug of NOASK
  329.            not being recognised.  Now removes text in URL after "?"s.
  330. v0.52ß ( 8-12-98) - Basically update documentation ready for it's first Aminet
  331.                    release, for when packaged along with HTTPResume.  Added an
  332.            untested DEPTH feature in the special v0.52aß.
  333. v0.51ß (??-??-98) - Internal speed-up (may be much faster downloading small pages)
  334.                   - minor fix of arguments given to HTTPResume
  335. v0.5ß  (??-??-98) - Initial release to a few people.  No bugs, honest =:)
  336.